import Camera
class uniMap:
    def __init__(self):
        #max image size to render on it
        self.render_width=0
        self.render_height=0
        self.map_w=0 #map width
        self.map_h=0 #map height
        self.map_z=0 #number of layers
        #grid size
        self.gridw=32
        self.gridh=32
        #default camera
        self.camera=Camera.uniCamera()
        #opis warstw
        self.layers=[]
        self.gameobjects=[]

    #get screen coord from map coord
    #mappos is list of 3 elements np. (0,0,0)
    #return: [sx,sy]
    def map_to_screen(self,mappos=(0,0,0)):
        if mappos[0] in range(0,self.map_w) and mappos[1] in range(0,self.map_h) and mappos[2] in range(0,self.map_z):
            sx=self.gridw*mappos[0]
            sy=self.gridh*mappos[1]
            if sx>-1 and sx<=self.map_w*self.gridw and sy>-1 and sx<=self.map_h*self.gridh:
                return [sx,sy]
            
    #get map coord from screen coord
    def screen_to_map(self,screencoord):
        mx=screencoord/self.gridw
        my=screencoord/self.gridh
        return [mx,my]
    #set tile on the map
    # mpos pozycja na mapie np. (0,0,0)
    # go gameobject to ustawienia
    def settile(self,mpos,go):
        pass
    #get tile from map
    #mpos pozycja objectu na mapie do zwrucenia
    def gettile(self,mpos):
        pass
    #load map from file
    def loadmap(self,filename):
        pass
        
    #save map to file
    def savemap(self,filename):
        pass
